package com.nanrui.mutualinductor.ui.service;

import com.nanrui.mutualinductor.communicate.PacketCallback;
import com.nanrui.mutualinductor.data.Packet_57_03;
import com.nanrui.mutualinductor.domains.DJGRegulationTransformerViewInfo;
import com.nanrui.mutualinductor.ui.page.DKActivity;


public class DJGRegulationTransformerService
{
    private DKActivity activity;

    public DJGRegulationTransformerService(DKActivity paramDKActivity)
    {
        this.activity = paramDKActivity;
    }

    public void display(DJGRegulationTransformerViewInfo djgRegulationTransformerViewInfo, Packet_57_03 paramPacket_57_03)
    {
        //tab1
        djgRegulationTransformerViewInfo.setsPhaseError(Float.valueOf(paramPacket_57_03.getsPhaseError()));
        djgRegulationTransformerViewInfo.setsQuadratureError(Float.valueOf(paramPacket_57_03.getsQuadratureError()));
        djgRegulationTransformerViewInfo.setsPrimaryU(Float.valueOf(paramPacket_57_03.getsWorkingVoltage()));
        djgRegulationTransformerViewInfo.setsSecondaryR(Float.valueOf(paramPacket_57_03.getsSecondaryR()));
        djgRegulationTransformerViewInfo.setsDCR(Float.valueOf(paramPacket_57_03.getsDCR()));
        djgRegulationTransformerViewInfo.setsXb(Float.valueOf(paramPacket_57_03.getsXb()));

        djgRegulationTransformerViewInfo.setsFErrors(paramPacket_57_03.getsFErrors());
        djgRegulationTransformerViewInfo.setsDErrors(paramPacket_57_03.getsDErrors());

        //tab2
        djgRegulationTransformerViewInfo.setsG(Float.valueOf(paramPacket_57_03.getsPhaseError()));
        djgRegulationTransformerViewInfo.setsB(Float.valueOf(paramPacket_57_03.getsQuadratureError()));
        djgRegulationTransformerViewInfo.setsSecondaryU(Float.valueOf(paramPacket_57_03.getsWorkingVoltage()));

        djgRegulationTransformerViewInfo.setsUErrors(paramPacket_57_03.getsUErrors());
        djgRegulationTransformerViewInfo.setsURoundErrors(paramPacket_57_03.getsURoundErrors());
        djgRegulationTransformerViewInfo.setsPhaseDisps(paramPacket_57_03.getsPhaseDisps());
        djgRegulationTransformerViewInfo.setsPhaseRoundDisps(paramPacket_57_03.getsPhaseRoundDisps());


        djgRegulationTransformerViewInfo.setsUErrors2(paramPacket_57_03.getsUErrors2());
        djgRegulationTransformerViewInfo.setsURoundErrors2(paramPacket_57_03.getsURoundErrors2());
        djgRegulationTransformerViewInfo.setsPhaseDisps2(paramPacket_57_03.getsPhaseDisps2());
        djgRegulationTransformerViewInfo.setsPhaseRoundDisps2(paramPacket_57_03.getsPhaseRoundDisps2());

        djgRegulationTransformerViewInfo.setsUErrors2(paramPacket_57_03.getsUErrors2());
        djgRegulationTransformerViewInfo.setsURoundErrors2(paramPacket_57_03.getsURoundErrors2());
        djgRegulationTransformerViewInfo.setsPhaseDisps2(paramPacket_57_03.getsPhaseDisps2());
        djgRegulationTransformerViewInfo.setsPhaseRoundDisps2(paramPacket_57_03.getsPhaseRoundDisps2());
    }

    public DJGRegulationTransformerViewInfo getDefaultViewInfo()
    {
        DJGRegulationTransformerViewInfo djgRegulationTransformerViewInfo = new DJGRegulationTransformerViewInfo();
        djgRegulationTransformerViewInfo.setmStatus((short)1);

        return djgRegulationTransformerViewInfo;
    }

    public void queryData(DJGRegulationTransformerViewInfo djgRegulationTransformerViewInfo, PacketCallback<Packet_57_03> paramPacketCallback)
    {
        Packet_57_03 localPacket_57_3 = new Packet_57_03();
        localPacket_57_3.setmFlag((short)3);
        localPacket_57_3.setFrameNo((short) 03);
        localPacket_57_3.setmGrade(djgRegulationTransformerViewInfo.getmGrade());
        localPacket_57_3.setmRatedPrimary(djgRegulationTransformerViewInfo.getmRatedPrimary());
        localPacket_57_3.setmRatedCapacitance(djgRegulationTransformerViewInfo.getmRatedCapacitance());
        localPacket_57_3.setPl(djgRegulationTransformerViewInfo.getPl());
        //额定2次
        localPacket_57_3.setmRatedSecondary(djgRegulationTransformerViewInfo.getmRatedSecondary());
        localPacket_57_3.setmGrade(djgRegulationTransformerViewInfo.getmGrade());
        localPacket_57_3.setsRatedSecondary(djgRegulationTransformerViewInfo.getsRatedSecondary());
        localPacket_57_3.setsGrade(djgRegulationTransformerViewInfo.getsGrade());
        localPacket_57_3.setsRatedSecondary2(djgRegulationTransformerViewInfo.getsRatedSecondary2());
        localPacket_57_3.setsGrade2(djgRegulationTransformerViewInfo.getsGrade2());

        //计量
        localPacket_57_3.setmMeaWinRatedLoad(djgRegulationTransformerViewInfo.getmMeaWinRatedLoad());
        localPacket_57_3.setmMeaWinMiniLoad(djgRegulationTransformerViewInfo.getmMeaWinMiniLoad());
        //测试
        localPacket_57_3.setmSurWinRatedLoad(djgRegulationTransformerViewInfo.getmSurWinRatedLoad());
        localPacket_57_3.setmSurWinMiniLoad(djgRegulationTransformerViewInfo.getmSurWinMiniLoad());
        localPacket_57_3.setmSurWinRatedLoad2(djgRegulationTransformerViewInfo.getmSurWinRatedLoad2());
        localPacket_57_3.setmSurWinMiniLoad2(djgRegulationTransformerViewInfo.getmSurWinMiniLoad2());

        localPacket_57_3.setmPhaseAngle(djgRegulationTransformerViewInfo.getmPhaseAngle());
        this.activity.sendPacket(localPacket_57_3, paramPacketCallback);
    }

    public void resetResult(DJGRegulationTransformerViewInfo djgRegulationTransformerViewInfo)
    {
        djgRegulationTransformerViewInfo.setsPhaseError(null);
        djgRegulationTransformerViewInfo.setsQuadratureError(null);
        djgRegulationTransformerViewInfo.setsPrimaryU(null);
        djgRegulationTransformerViewInfo.setsSecondaryR(null);
        djgRegulationTransformerViewInfo.setsDCR(null);
        djgRegulationTransformerViewInfo.setsXb(null);
        djgRegulationTransformerViewInfo.setsFErrors(null);
        djgRegulationTransformerViewInfo.setsDErrors(null);
        djgRegulationTransformerViewInfo.setsG(null);
        djgRegulationTransformerViewInfo.setsB(null);
        djgRegulationTransformerViewInfo.setsSecondaryU(null);
        djgRegulationTransformerViewInfo.setsUErrors(null);
        djgRegulationTransformerViewInfo.setsURoundErrors(null);
        djgRegulationTransformerViewInfo.setsPhaseDisps(null);
        djgRegulationTransformerViewInfo.setsPhaseRoundDisps(null);
        djgRegulationTransformerViewInfo.setsResult(null);
        djgRegulationTransformerViewInfo.setsUErrors2(null);
        djgRegulationTransformerViewInfo.setsURoundErrors2(null);
        djgRegulationTransformerViewInfo.setsPhaseDisps2(null);
        djgRegulationTransformerViewInfo.setsPhaseRoundDisps2(null);
        djgRegulationTransformerViewInfo.setsResult2(null);
        djgRegulationTransformerViewInfo.setsUErrors3(null);
        djgRegulationTransformerViewInfo.setsURoundErrors3(null);
        djgRegulationTransformerViewInfo.setsPhaseDisps3(null);
        djgRegulationTransformerViewInfo.setsPhaseRoundDisps3(null);
        djgRegulationTransformerViewInfo.setsResult3(null);
    }

    public void start1ndMeasure(DJGRegulationTransformerViewInfo djgRegulationTransformerViewInfo, PacketCallback<Packet_57_03> paramPacketCallback)
    {
        Packet_57_03 localPacket_57_03 = new Packet_57_03();
        localPacket_57_03.setmFlag((short)1);
        localPacket_57_03.setFrameNo((short) 03);
        localPacket_57_03.setmGrade(djgRegulationTransformerViewInfo.getmGrade());
        localPacket_57_03.setmRatedPrimary(djgRegulationTransformerViewInfo.getmRatedPrimary());
        localPacket_57_03.setmRatedCapacitance(djgRegulationTransformerViewInfo.getmRatedCapacitance());
        localPacket_57_03.setPl(djgRegulationTransformerViewInfo.getPl());
        //额定2次
        localPacket_57_03.setmRatedSecondary(djgRegulationTransformerViewInfo.getmRatedSecondary());
        localPacket_57_03.setmGrade(djgRegulationTransformerViewInfo.getmGrade());

        localPacket_57_03.setsRatedSecondary(djgRegulationTransformerViewInfo.getsRatedSecondary());
        localPacket_57_03.setsGrade(djgRegulationTransformerViewInfo.getsGrade());
        localPacket_57_03.setsRatedSecondary2(djgRegulationTransformerViewInfo.getsRatedSecondary2());
        localPacket_57_03.setsGrade2(djgRegulationTransformerViewInfo.getsGrade2());

        //计量
        localPacket_57_03.setmMeaWinRatedLoad(djgRegulationTransformerViewInfo.getmMeaWinRatedLoad());
        localPacket_57_03.setmMeaWinMiniLoad(djgRegulationTransformerViewInfo.getmMeaWinMiniLoad());
        //测试
        localPacket_57_03.setmSurWinRatedLoad(djgRegulationTransformerViewInfo.getmSurWinRatedLoad());
        localPacket_57_03.setmSurWinMiniLoad(djgRegulationTransformerViewInfo.getmSurWinMiniLoad());

        localPacket_57_03.setmSurWinRatedLoad2(djgRegulationTransformerViewInfo.getmSurWinRatedLoad2());
        localPacket_57_03.setmSurWinMiniLoad2(djgRegulationTransformerViewInfo.getmSurWinMiniLoad2());
        localPacket_57_03.setmPhaseAngle(djgRegulationTransformerViewInfo.getmPhaseAngle());
        this.activity.sendPacket(localPacket_57_03, paramPacketCallback);
    }

    public void stopMeasure(DJGRegulationTransformerViewInfo djgRegulationTransformerViewInfo, PacketCallback<Packet_57_03> paramPacketCallback)
    {
        Packet_57_03 localPacket_57_03 = new Packet_57_03();
        localPacket_57_03.setmFlag((short)4);
        localPacket_57_03.setFrameNo((short) 03);
        localPacket_57_03.setmGrade(djgRegulationTransformerViewInfo.getmGrade());
        localPacket_57_03.setmRatedPrimary(djgRegulationTransformerViewInfo.getmRatedPrimary());
        localPacket_57_03.setmRatedCapacitance(djgRegulationTransformerViewInfo.getmRatedCapacitance());
        localPacket_57_03.setPl(djgRegulationTransformerViewInfo.getPl());
        //额定2次
        localPacket_57_03.setmRatedSecondary(djgRegulationTransformerViewInfo.getmRatedSecondary());
        localPacket_57_03.setmGrade(djgRegulationTransformerViewInfo.getmGrade());
        localPacket_57_03.setsRatedSecondary(djgRegulationTransformerViewInfo.getsRatedSecondary());
        localPacket_57_03.setsGrade(djgRegulationTransformerViewInfo.getsGrade());
        localPacket_57_03.setsRatedSecondary2(djgRegulationTransformerViewInfo.getsRatedSecondary2());
        localPacket_57_03.setsGrade2(djgRegulationTransformerViewInfo.getsGrade2());

        //计量
        localPacket_57_03.setmMeaWinRatedLoad(djgRegulationTransformerViewInfo.getmMeaWinRatedLoad());
        localPacket_57_03.setmMeaWinMiniLoad(djgRegulationTransformerViewInfo.getmMeaWinMiniLoad());
        //测试
        localPacket_57_03.setmSurWinRatedLoad(djgRegulationTransformerViewInfo.getmSurWinRatedLoad());
        localPacket_57_03.setmSurWinMiniLoad(djgRegulationTransformerViewInfo.getmSurWinMiniLoad());
        localPacket_57_03.setmSurWinRatedLoad2(djgRegulationTransformerViewInfo.getmSurWinRatedLoad2());
        localPacket_57_03.setmSurWinMiniLoad2(djgRegulationTransformerViewInfo.getmSurWinMiniLoad2());
        localPacket_57_03.setmPhaseAngle(djgRegulationTransformerViewInfo.getmPhaseAngle());
        this.activity.sendPacket(localPacket_57_03, paramPacketCallback);
    }

    public void updateConfig(DJGRegulationTransformerViewInfo djgRegulationTransformerViewInfo, PacketCallback<Packet_57_03> paramPacketCallback)
    {
        Packet_57_03 localPacket_57_03 = new Packet_57_03();
        localPacket_57_03.setmFlag((short)0);
        localPacket_57_03.setFrameNo((short) 03);
        localPacket_57_03.setmGrade(djgRegulationTransformerViewInfo.getmGrade());
        localPacket_57_03.setmRatedPrimary(djgRegulationTransformerViewInfo.getmRatedPrimary());
        localPacket_57_03.setmRatedCapacitance(djgRegulationTransformerViewInfo.getmRatedCapacitance());
        localPacket_57_03.setPl(djgRegulationTransformerViewInfo.getPl());
        //额定2次
        localPacket_57_03.setmRatedSecondary(djgRegulationTransformerViewInfo.getmRatedSecondary());
        localPacket_57_03.setmGrade(djgRegulationTransformerViewInfo.getmGrade());
        localPacket_57_03.setsRatedSecondary(djgRegulationTransformerViewInfo.getsRatedSecondary());
        localPacket_57_03.setsGrade(djgRegulationTransformerViewInfo.getsGrade());
        localPacket_57_03.setsRatedSecondary2(djgRegulationTransformerViewInfo.getsRatedSecondary2());
        localPacket_57_03.setsGrade2(djgRegulationTransformerViewInfo.getsGrade2());

        //计量
        localPacket_57_03.setmMeaWinRatedLoad(djgRegulationTransformerViewInfo.getmMeaWinRatedLoad());
        localPacket_57_03.setmMeaWinMiniLoad(djgRegulationTransformerViewInfo.getmMeaWinMiniLoad());
        //测试
        localPacket_57_03.setmSurWinRatedLoad(djgRegulationTransformerViewInfo.getmSurWinRatedLoad());
        localPacket_57_03.setmSurWinMiniLoad(djgRegulationTransformerViewInfo.getmSurWinMiniLoad());
        localPacket_57_03.setmSurWinRatedLoad2(djgRegulationTransformerViewInfo.getmSurWinRatedLoad2());
        localPacket_57_03.setmSurWinMiniLoad2(djgRegulationTransformerViewInfo.getmSurWinMiniLoad2());
        localPacket_57_03.setmPhaseAngle(djgRegulationTransformerViewInfo.getmPhaseAngle());
        this.activity.sendPacket(localPacket_57_03, paramPacketCallback);
    }
}

